<style type="text/css">
    .dropdown-menu {
        max-height: 303px;
    } 
    .switch{
        width: 28px;
        height: 14px;
    }
    .switch small{
        width: 14px;
        height: 14px;
    }
    .switch.checked small{
        left: 13px;
    }
</style>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <span>项目: <span style="color: #1da7ee">{{info.planInfo.plan_name}}</span></span>
                    <span style="margin-left: 2%;" ng-if="info.integrationInfo != null">集成计划:
                        <a href="javascript:void(0);" class="btn-link" type="button"
                           ng-click="toIntegrationSet(info.integrationInfo.integration_name);">{{info.integrationInfo.integration_name}}</a>
                    </span>
                    <br>
                    <br>
                    <div ng-if="info.planInfo.plan_status == 'PLAN_NEW'">
                        <p>
                            <input ng-model="info.checked" ng-true-value="true"
                                   ng-if="info.modifiAble"
                                   ng-false-value="false" type="checkbox">
                            <span ng-if="info.modifiAble">作为项目负责人，已经检查过基本功能，同意将项目提交给集成测试环境</span>
                        </p>
                        <button class="btn btn-default pull-left" ng-if="info.modifiAble"
                                ng-disabled="!info.checked"
                                data-ng-click="doIntegration();">转测集成
                        </button>
                        <span ng-show="info.modifiAble && !info.checked"
                              style="line-height: 30px;margin-left: 50px;color: red;">请确认项目无误后，再转测集成</span>
                        <!--<span ng-show="info.modifiAble && !info.can_Integration"-->
                        <!--style="line-height: 30px;margin-left: 50px;color: red;">当前项目内存在没有转测的工程，不能集成</span>-->
                    </div>
                    <span ng-if="info.planInfo.plan_status != 'PLAN_NEW'">项目已经转测集成</span>
                </div>
                <div class="box-body">
                    <div class="container-fluid">
                        <div class="row-fluid">

                            <div class="span12">
                                <ul class="nav nav-tabs">
                                    <li class="" ng-class="{true:'active',false:''}[info.index==0]">
                                        <a href="javascript:void(0)"
                                           data-toggle="tab" ng-click="title(0)"
                                        >
                                            工程列表
                                        </a>
                                    </li>
                                    <li class="" ng-class="{true:'active',false:''}[info.index==1]">
                                        <a href="javascript:void(0)"
                                           data-toggle="tab" ng-click="title(1)"
                                        >
                                            虚拟机申请
                                        </a>
                                    </li>
                                    <li class="" ng-class="{true:'active',false:''}[info.index==2]">
                                        <a href="javascript:void(0)"
                                           data-toggle="tab" ng-click="title(2)"
                                        >
                                            测试记录
                                        </a>
                                    </li>
                                </ul>
                                <div class="row">
                                    <div class="col-xs-12">
                                        <div ng-if="info.index == '0'">
                                            <div class="box-header">
                                                <img src="/beetle/image/icon_plus-box.png" ng-if="info.modifiAble"
                                                     ng-click="add();"
                                                     style="cursor: pointer;"
                                                     data-toggle="popover" data-placement="auto top"
                                                     data-content="为项目添加工程"
                                                     data-trigger="hover">
                                                <span style="margin-left: 4%;">分支代号: {{info.planInfo.plan_code}}</span>
                                                <br>
                                                <br>
                                                <span ng-if="info.planInfo.error_desc != null" style="color: red;">工程创建失败：{{info.planInfo.error_desc}}</span>
                                            </div>
                                            <div class="box-body" style=" ">
                                                <table class="table table-bordered">
                                                    <thead>
                                                    <tr>
                                                        <th width="5%">工程</th>
                                                        <th width="5%">分支</th>
                                                        <th width="5%">构建状态</th>
                                                        <th width="5%">代码版本库</th>
                                                        <th width="5%">分支版本号</th>
                                                        <th width="5%">状态</th>
                                                        <th width="5%">提测版本</th>
                                                        <th width="5%">测试中版本</th>
                                                        <th width="5%">申请集成版本</th>
                                                        <th width="5%">当前集成版本</th>
                                                        <th width="5%" ng-if="info.modifiAble">操作</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr ng-repeat="i in info.planInfo.projects |filter:filter|paging:page.index:page.size">
                                                        <td>
                                                            {{i.trunk_name}}
                                                        </td>
                                                        <td>
                                                            <span ng-if="i.isOnBeetle == '0'">
                                                                <a href="javascript:void(0)" class="btn-link" type="button"
                                                                   data-toggle="popover" data-placement="auto top"
                                                                   data-content="{{i.branchTip}}" data-html="true"
                                                                   data-trigger="hover">
                                                                {{i.project_name | limitTo: 20}}...</a>
                                                            <img uib-popover="点击跳转至工程构建页面"
                                                                 ng-show="i.isOnBeetle == '0' && i.package_type!='maven_jar'"
                                                                 popover-trigger="mouseenter"
                                                                 src="/beetle/image/link.png" ng-click="link(i);"
                                                                 style="cursor: pointer;width: 20px;float: right;">
                                                            </span>
                                                        </td>
                                                        <td>
                                                            <span ng-if="i.isOnBeetle == '0'">
                                                                {{i.build_status}}
                                                            </span>
                                                        </td>
                                                        <td>
                                                            <span ng-if="i.isOnBeetle == '0'">
                                                                <span ng-if="i.vcs_path.length <= 20">{{i.vcs_path}}</span>
                                                                <a ng-if="i.vcs_path.length > 20" href="javascript:void(0)"
                                                                   class="btn-link" type="button"
                                                                   popover-placement="auto top"
                                                                   popover-trigger="outsideClick"
                                                                   uib-popover-html="i.vcs_path">{{i.vcs_path | limitTo:20}}...</a>
                                                            </span>
                                                        </td>
                                                        <td>
                                                            {{i.branch_num}}
                                                        </td>
                                                        <td>
                                                            {{getStatusDesc(i.project_status)}}
                                                        </td>
                                                        <td>
                                                            {{i.to_test_edition}}
                                                        </td>
                                                        <td>
                                                            {{i.testing_edition}}
                                                        </td>
                                                        <td>
                                                            {{i.to_integration_edition}}
                                                        </td>
                                                        <td>
                                                            {{i.integrationing_edition}}
                                                        </td>
                                                        <td ng-if="info.modifiAble">
                                                            <i ng-show="(i.isOnBeetle == '0' && i.project_status != 'PRO_MERGED' && i.package_type!='maven_jar') || (i.package_type=='ad')"
                                                               class="glyphicon glyphicon-hand-right"
                                                               ng-click="project_edit(i)" uib-popover="修改工程当前提测版本"
                                                               popover-trigger="mouseenter"
                                                               style="cursor: pointer;width: 23px;" popover-placement="auto"></i>
                                                            <i ng-show="isUserCanOperateByRole('plan_admin','pm','dev','qa') && ((i.isOnBeetle == '0' && i.project_status != 'PRO_MERGED' && (i.package_type!='maven_jar')) || (i.package_type=='ad'))"
                                                               class="glyphicon glyphicon-hand-right"
                                                               ng-click="updateToIntegrationEdition(i)"
                                                               uib-popover="修改工程申请集成版本"
                                                               popover-trigger="mouseenter"
                                                               style="cursor: pointer;width: 23px;color: gold;" popover-placement="auto"></i>
                                                            <i class="glyphicon glyphicon-trash" ng-click="del(i);"
                                                               style="cursor: pointer;width: 20px;" uib-popover="删除工程"
                                                               popover-trigger="mouseenter" popover-placement="auto"></i>
                                                            <i ng-show="i.isOnBeetle == '0' && i.package_type!='maven_jar' && i.project_status != 'PRO_MERGED'"
                                                               class="fa fa-code-fork" ng-click="changePlanPro(i);"
                                                               uib-popover="切换工程分支" popover-trigger="mouseenter" popover-placement="auto"
                                                               style="cursor: pointer;font-size: 18px;"></i>
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                            <uib-pagination total-items="info.planInfo.projects|filter:filter|size"
                                                            ng-model="page.index"
                                                            max-size="5"
                                                            previous-text="上一页"
                                                            next-text="下一页"
                                                            first-text="首页"
                                                            last-text="尾页"

                                                            items-per-page="page.size"

                                                            class="pagination-sm pull-right"
                                                            boundary-links="true"></uib-pagination>
                                        </div>

                                        <div ng-if="info.index == '1'">
                                            <div class="box-body" style="width: 40%; ">
                                                <table class="table table-bordered">
                                                    <thead>
                                                    <tr>
                                                        <th width="5%">虚拟机</th>
                                                        <th width="10%">IP</th>
                                                        <th width="5%">状态</th>
                                                    </tr>
                                                    </thead>
                                                    <tbody>
                                                    <tr class="item" ng-repeat="i in info.applyInfo">
                                                        <td>
                                                            {{i.type}}
                                                        </td>
                                                        <td>
                                                            <a href="javascript:void(0);" class="btn-link" type="button"
                                                               ng-click="toAgent(i);">{{i.agent_ip}}</a>
                                                        </td>
                                                        <td>
                                                            {{i.status}}
                                                        </td>
                                                    </tr>
                                                    </tbody>
                                                </table>
                                            </div>
                                        </div>
                                        <div ng-if="info.index == '2'">
                                          <u-test-record is-project='false' project-id='{{id}}'></u-test-record>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>